package model

import (
	"github.com/shopspring/decimal"
	"gorm.io/gorm"
)

type OrderInfo struct { // 订单表
	ID           int             `gorm:"primaryKey;not null;auto_increment"`
	OrderId      int             `gorm:"size:128;comment:订单编号"`
	PayMethod    int             `gorm:"default:3;comment:付款方式"` // 1货到付款，2微信支付，3支付宝，4银联支付
	TotalCount   int             `gorm:"default:1;comment:商品数量"`
	TotalPrice   decimal.Decimal `gorm:"type:decimal(10,2);comment:商品总价"`
	TransitPrice decimal.Decimal `gorm:"type:decimal(10,2);comment:订单运费"`
	OrderStatus  int             `gorm:"default:1;comment:订单状态"` // 1待支付，2代发货，3待收货，4待评价，5已完成
	TradeNo      string          `gorm:"size:128;comment:支付编号"`  // 第三方支付平台返回的支付编号
	User_Id      int
	Address_Id   int
	OrderGoods   []*OrderGoods `gorm:"foreignKey:OrderInfo_Id;references:OrderId"`
	gorm.Model
}

type OrderGoods struct { // 订单商品列表
	ID           int
	Count        int             `gorm:"default:1;comment:商品数目"`
	Price        decimal.Decimal `gorm:"type:decimal(10,2);comment:商品价格"`
	Comment      string          `gorm:"size:256;comment:商品评论"`
	OrderInfo_Id int
	GoodsSKU_Id  int
	gorm.Model
}
